# -*- coding: utf-8 -*-
from django.contrib import admin
#from bigmama.BabyMgr.models import Parent
from bigmama.BabyMgr.models import Baby
from bigmama.BabyMgr.models import HeightHistory 
from bigmama.BabyMgr.models import WeightHistory
from bigmama.BabyMgr.models import BabyFoodHistory
from bigmama.BabyMgr.models import ChildcareDairy
from bigmama.BabyMgr.models import PhotoHistory

class ParentAdmin(admin.ModelAdmin):
    fieldsets = (
        (None, {
            'fields' : ('parent_id', 'gender', 'cellphone')
        }),
        ('birth day', {'fields' : ['birth'], 'classes' : ['collapse']}),
    )
    list_display = ('parent_id', 'cellphone', 'gender')
    search_fields = ['name']
    date_hierarchy = 'birth'
       
class BabyAdmin(admin.ModelAdmin):
    fieldsets = (
        (None, {
            'fields' : ('parent', 'name', 'gender')
        }),
        ('birth day', {'fields' : ['birth'], 'classes' : ['collapse']}),
    )
    list_display = ('name', 'parent', 'gender')
    search_fields = ['name']
    date_hierarchy = 'birth'

class HeightHistoryAdmin(admin.ModelAdmin):
    date_hierarchy = 'record_date'
    
    fieldsets = (
        (None, {
            'fields' : ('baby', 'height')
        }),
        ('record_date', {'fields' : ['record_date'], 'classes' : ['collapse']}),
    )           
    
    list_display = ('baby', 'height')
    search_fields = ['baby']   


class WeightHistoryAdmin(admin.ModelAdmin):
    date_hierarchy = 'record_date'
    
    fieldsets = (
        (None, {
            'fields' : ('baby', 'weight')
        }),
        ('record_date', {'fields' : ['record_date'], 'classes' : ['collapse']}),
    )           
    
    list_display = ('baby', 'weight')
    search_fields = ['baby']
       
class BabyFoodHistoryAdmin(admin.ModelAdmin):
    date_hierarchy = 'record_date'
    
    fieldsets = (
        (None, {
            'fields' : ('baby', 'menu', 'capacity')
        }),
        ('record_date', {'fields' : ['record_date'], 'classes' : ['collapse']}),
    )           
    
    list_display = ('baby', 'menu', 'capacity')
    search_fields = ['baby']

class ChildcareDairyAdmin(admin.ModelAdmin):
    date_hierarchy = 'record_date'
    
    fieldsets = (
        (None, {
            'fields' : ('baby', 'memo')
        }),
        ('record_date', {'fields' : ['record_date'], 'classes' : ['collapse']}),
    )           
    
    list_display = ('baby', 'memo')
    search_fields = ['baby']   

class PhotoHistoryAdmin(admin.ModelAdmin):
    date_hierarchy = 'record_date'
    
    fieldsets = (
        (None, {
            'fields' : ('baby', 'photo_file', 'gps_info', 'voice_file', 'memo')
        }),
        ('record_date', {'fields' : ['record_date'], 'classes' : ['collapse']}),
    )           
    
    list_display = ('baby', 'photo_file', 'memo', 'voice_file', 'gps_info')
    search_fields = ['baby']
       
#admin.site.register(Parent, ParentAdmin)
#admin.site.register(HeightHistory, HeightHistoryAdmin)
#admin.site.register(WeightHistory, WeightHistoryAdmin)
#admin.site.register(BabyFoodHistory, BabyFoodHistoryAdmin)
#admin.site.register(ChildcareDairy, ChildcareDairyAdmin)
#admin.site.register(PhotoHistory, PhotoHistoryAdmin)
#admin.site.register(Baby, BabyAdmin)

#admin.site.register(Parent)
admin.site.register(HeightHistory)
admin.site.register(WeightHistory)
admin.site.register(BabyFoodHistory)
admin.site.register(ChildcareDairy)
admin.site.register(PhotoHistory)
admin.site.register(Baby)
